<!--conf
<sample>
              <product version="1.4" edition="std"/>
                     <modifications>
                            <modified date="070101"/>
                     </modifications>
               </sample>
 --> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Refresh grid from XML</title>
	



</head>
<style>
	
    .even{
        background-color:#E6E6FA;
    }
    .uneven{
        background-color:#F0F8FF;
    }


</style>
<body>
<link rel='STYLESHEET' type='text/css' href='../common/style.css'>
<table cellspacing="0" cellpadding="0" class="sample_header" border="0">
	<tr valign="middle">
		<!-- COMPONENT ICON -->
		<td width="40" align="center"><img src="../common/dhtmlxgrid_icon.gif" border="0"></td>
		<!-- COMPONENT NAME -->
		<td width="150" align="left" nowrap="true">Sample: dhtmlxGrid</td>
		<!-- SAMPLE TITLE -->
		<td width="0" align="left" nowrap><b>Refresh grid from XML</b></td>
		<!-- LINK TO COMPONENT PAGE -->
		<td width="0" align="right"><a href="http://www.dhtmlx.com/docs/products/dhtmlxGrid/index.shtml">dhtmlxGrid main page</a></td>
		<!-- CLOSE BUTTON -->
		<td width="50"><div class="sample_close"><a href="javascript:void(0);" onclick="self.close();"><img src="../common/sample_close.gif" width="14" height="14" border="0" alt="X"></a></div></td>
	</tr>
</table>
	
	
	<p>Refresh operation doesn't recreate grid, it just updates data in it, as result the state of grid fully preserved</p>

	<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxgrid.css">
	<script  src="../../codebase/dhtmlxcommon.js"></script>
	<script  src="../../codebase/dhtmlxgrid.js"></script>	
	<script  src="../../codebase/dhtmlxgridcell.js"></script>
		
	<table width="600">
		<tr>
			<td>
				<div id="gridbox" width="100%" height="200px" style="background-color:white;"></div>
			</td>
		</tr>
		<tr>

		</tr>
	</table>
<br>
<h3><div><a href="#" onclick="mygrid.clearAll(); mygrid.loadXML('first.xml');">Reload grid - classic way</a></div></h3>
<h3><div><a href="#" onclick="mygrid.loadXML('second.xml');">Reload grid - clear grid from XML</a></div></h3>
<h3><div><a href="#" onclick="mygrid.updateFromXML('third.xml');">Reload grid - refresh data only </a></div></h3>
<br>
<p>Classic way</p>
<div class='sample_code'><div class="hl-main"><pre><span class="hl-code"> 
 </span><span class="hl-identifier">mygrid</span><span class="hl-code">.</span><span class="hl-identifier">clearAll</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-identifier">mygrid</span><span class="hl-code">.</span><span class="hl-identifier">loadXML</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">first.xml</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code">;</span></pre></div></div>
 <p>Clear grid from XML</p>
<div class='sample_code'><div class="hl-main"><pre><span class="hl-code"> 
 </span><span class="hl-identifier">mygrid</span><span class="hl-code">.</span><span class="hl-identifier">loadXML</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">second.xml</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code">;</span></pre></div></div>
 <p>Refresh data only</p>
<div class='sample_code'><div class="hl-main"><pre><span class="hl-code"> 
 </span><span class="hl-identifier">mygrid</span><span class="hl-code">.</span><span class="hl-identifier">updateFromXMl</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">third.xml</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code">;</span></pre></div></div>


<script>



	mygrid = new dhtmlXGridObject('gridbox');
	mygrid.setImagePath("../../codebase/imgs/");
	mygrid.setHeader("Sales,edtxt,ed,Price,In Store,Shipping,Bestseller,Date of Publication");
	mygrid.setInitWidths("50,150,100,80,80,80,80,200")
	mygrid.setColAlign("right,left,left,right,center,left,center,center")
	mygrid.setColTypes("dyn,edtxt,ed,price,ch,co,ra,ro");
    mygrid.getCombo(5).put(2,2);
	mygrid.setColSorting("int,str,str,int,str,str,str,date")
    mygrid.enableAlterCss("even","uneven");
	mygrid.init();
	mygrid.loadXML("grid.xml");
</script>

<!-- FOOTER -->
<table callspacing="0" cellpadding="0" border="0" class="sample_footer"><tr><td style="padding-left: 8px;">&copy; <a href="http://www.dhtmlx.com">DHTMLX LTD</a>. All rights reserved</td></tr></table>
<!-- FOOTER -->

</body>
</html>
